package com.yidu.BusinessData.mapper;

import com.yidu.BusinessData.entity.Broker;
import com.yidu.BusinessData.entity.TradingSeats;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

/**
 * 交易席位dao类
 * @author zhouhongyu
 * @since 2022/8/16
 * @version 1.0
 */
@Mapper
public interface TradingSeatsMapper {
    /**
     * 查询条数
     * @return
     */
    @Select("select count(*) from tradingseats")
    public int selectCount();

    /**
     * 查询席位信息
     * @param map
     * @return
     */
    @Select("SELECT * FROM tradingseats a JOIN broker s ON a.brokerId = s.brokerId WHERE 1=1 ${strWrteem} order by seatId limit #{page},#{limit}")
    public List<TradingSeats> selectTradingSeats(Map map);

    /**
     * 增加席位信息
     * @param seats
     * @return
     */
    @Insert("insert into tradingseats values (#{seatId},#{brokerId},#{seatType},#{commission},#{seatName},#{seatPlace},#{seatBeiZhu})")
    public int insertTradingSeats(TradingSeats seats);

    /**
     * 删除席位信息
     * @param seatId
     * @return
     */
    @Delete("delete from tradingseats where seatId = #{seatId}")
    public int deleteTradingSeats(String seatId);

    /**
     * 修改席位信息
     * @param tradingSeats
     * @return
     */
    @Update("update tradingseats set seatName=#{seatName},seatType=#{seatType},commission=#{commission},brokerId=#{brokerId},seatPlace=#{seatPlace},seatBeiZhu=#{seatBeiZhu} where seatId = #{seatId}")
    public int updateTradingSeats(TradingSeats tradingSeats);

    /**
     * 下拉表格
     * @return
     */
    @Select("select * from broker")
    List<Broker> selectBroker1();



}
